package logic

import (
	"base/models/mysql"
	"context"

	"base/baserpc/baserpc"
	"base/baserpc/internal/svc"

	"github.com/zeromicro/go-zero/core/logx"
)

type ShowLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewShowLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ShowLogic {
	return &ShowLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 详情
func (l *ShowLogic) Show(in *baserpc.ShowRequest) (*baserpc.ShowResponse, error) {
	// todo: add your logic here and delete this line
	var note mysql.Note
	mysql.DB.Debug().Find(&note)
	return &baserpc.ShowResponse{
		Title:   note.Title,
		Address: note.Address,
		Noteid:  int64(note.NoteId),
	}, nil
}
